package ObjectDemo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2023-04-06
 * Time: 8:59
 */
public class Student extends Person{
    public Student() {
    }

    public Student(String name, int age) {
        super(name, age);
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object obj) {
        if(obj == null) return false;
        if( this == obj) return true;
        if(!(obj instanceof Student)) return false;
        Student student = (Student) obj;
        return this.name.equals(student.name) && this.age == student.age;
    }

}
